< previous page page_43 next page >

Page 43
smaller dataset: The smaller the dataset, the faster your program can process the data. Visual Basic data objects give you the power to create datasets that are the proper size for your needs.
The Dynaset-Type Recordset Data Object
The Visual Basic Dynaset-type Recordset data object is the most frequently used data object in Visual Basic programs. It is used to dynamically gain access to part or all of an existing data table in a database, hence the name Dynaset. When you set the DatabaseName and RecordSource properties of a Visual Basic data control, you are actually creating a Visual Basic Dynaset-type Recordset. You can also create a Dynaset-type Recordset by using the CreateDynaset method of the Database object.
When you create a Visual Basic Dynaset-type Recordset, you do not create a new physical table in the database. A Dynaset exists as a virtual data table. This virtual table usually contains a subset of the records in a real data table, but it can contain the complete set. Because creating a Dynaset does not create a new physical table, Dynasets do not add to the size of the database. However, creating Dynasets does take up space in RAM on the machine that creates the set (the one that is running the program). Depending on the number of records in the Dynaset, temporary disk space can also be used on the machine requesting the dataset.
Strengths of the Dynaset-Type Recordset Object
There are several reasons to use Dynasets when you access data. In general, Dynasets require less memory than other data objects and provide the most update options, including the capability to create additional data objects from existing Dynasets. Dynasets are the default data objects for the Visual Basic data control, and they are the only updatable data object you can use for databases connected through Microsoft's Open Database Connectivity (ODBC) model. The following sections provide more details of the strengths of the Dynaset data object.
Dynasets Are Really Key Sets
Visual Basic Dynasets use relatively little workstation memory, even for large datasets. When you create a Dynaset, Visual Basic performs several steps. First, Visual Basic selects the records you requested. Then, it creates temporary index keys to each of these records and sends the complete set of keys to your workstation along with enough records to fill out any bound controls (text boxes and/or grid controls) that appear on your on-screen form. This process is illustrated in Figure 3.1.

 
< previous page page_43 next page >

If you like this book, buy it!